home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!setch.demon.co.uk
- From: Mark Setchell <Mark@setch.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: #including everything
- Date: Fri, 12 Apr 96 08:24:41 GMT
- Organization: DeltaPlusLtd
- Message-ID: <829297481snz@setch.demon.co.uk>
- Reply-To: Mark@setch.demon.co.uk
- X-NNTP-Posting-Host: setch.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: setch.demon.co.uk
-
- Does anyone have an opinion about how sensible it is to #include all
- standard system header files in C programs? I work on a project with
- approximately 2000 files and 500,000 lines of code and every file
- has a long piece at the start like this:
-
- #include <stdio.h>
- #include <errno.h>
- #if !defined(SGI) && !defined(HPUX)
- #include <x.h>
- #else
- #if !defined(IBM_R2) && !defined(CRAY)
- #include <y.h>
- #endif
- #endif
-
- This is obviously a maintenance nightmare, porting is no fun either. I
- am thinking of making a single include file with all system headers in
- it (i.e. ones in <> as opposed to those in "").
-
- I suspect the disadvantages are:
- 1) If it changes, all files have to be rebuilt - but that's ok it won't
- change often
- 2) It may bloat the size of the binaries by including unused variables,
- but that's not really a problem on Virtual Memory machines, and the
- increase in size isn't much anyway.
- 3) ???
-
- Weighed against this, the advantages are:
- 1) porting and maintenance become easier with only one file to maintain
- 2) all system calls/functions are guaranteed to be prototyped
- 3) ???
-
- Also, which system files should I #include?
-
- TIA
- --
- Mark Setchell (Mark@setch.demon.co.uk)
- 17 Hurst Place, Gillingham, Kent, England ME8 9AS
- Tel: +44-1634-264198
- Fax: +44-1634-264199
-